package com.example.loopyserver.component;

import jakarta.validation.ValidatorFactory;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

@Component
@RequiredArgsConstructor
public class Validator {
    private final ValidatorFactory factory;

    public boolean validate(Object object) {
        return object == null || factory.getValidator().validate(object).isEmpty();
    }
}
